<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // function unique3(array) {
        //     var result = [];
        //     var hash = {};
        //     for (var i = 0; i < array.length; i++) {
        //         var key = (typeof array[i]) + array[i];
        //         if (!hash[key]) {
        //             result.push(array[i]);
        //             hash[key] = true;
        //         }
        //     }
        //     return result;
        // }
        // var arr = ['aa', 'bb', 'cc', '', 1, 0, '1', 1, 'bb', null, undefined, null];
        // console.log(unique3(arr));

        function sele(arr) {
            var have = {};
            var result = [];
            for (var i = 0; i < arr.length; i++) {
                var key = typeof arr[i] + arr[i];
                if (!have[key]) {
                    result.push(arr[i]);
                    have[key] = true;
                }
            }
            return result;
        }
        var arr = ['aa', 'bb', 'cc', '', 1, 0, '1', 1, 'bb', null, undefined, null];
        var arr1 = sele(arr);
        console.log(arr1);
    </script>
</body>

</html>